#include <iostream>

using namespace std;

const int N = 10000002;
int isPrime[N];

int prime[N], pcnt;

const int N2 = 1000000200;
int isPrime2[N2];
long long base = (long long)10000000 * 10000000;

const int n = 100000;
long long prime2[n], pcnt2;

const long long mod = 1234567891011LL;

long long f1 = 921144120792LL, f2 = 199461219007LL;

int main()
{
    for (int i = 0; i < N; i++) isPrime[i] = 1;
    for (int i = 0; i < N2; i++) isPrime2[i] = 1;

    isPrime[0] = isPrime[1] = 0;
    for (int i = 2; i < N; i++) {
        if (isPrime[i]) {
            prime[pcnt++] = i;
            for (int j = i + i; j < N; j += i) {
                isPrime[j] = 0;
            }
        }
    }
    
    cout << "done prime calc" << endl;

    for (int i = 0; i < pcnt; i++) {
        long long m = base / prime[i];
        for (long long j = m; (long long)prime[i] * j < base + N; j++) {
            long long next = (long long)prime[i] * j;
            if (next >= base) {
                int ith = next - base;
                isPrime2[ith] = 0;
            }
        }
    }

    cout << "calculating pcnt2" << endl;
    for (int i = 0; i < N2; i++) {
        if (isPrime2[i]) {
            prime2[pcnt2++] = base + i;
        }
        
        if (pcnt2 == n) {
            break;
        }
    }

    cout << pcnt2 << endl;
    cout << "first two primes are: " << prime2[0] << ", " << prime2[1] << endl;

    int count = 0;
    int idx = 0;

    long long ans = 0;
    while (count < n) {
        if (isPrime2[idx]) {
            ans += f1;
            ans %= mod;
            count++;
        }

        idx++;
        long long t = f1 + f2;
        f1 = f2;
        f2 = t % mod;
    }
    cout << ans << endl; 
    return 0;
}
